num = int(input())
array1 = []
sum1 = 0
sum2 = 0
for i in range(num, 0, -1):
if sum1 <= sum2:
sum1 += i
array1.append(i)
else:
sum2 += i
print(abs(sum2 - sum1))
print(len(array1), end=" ")
for i in array1:
print(i, end=" ")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll z;
vector<ll>arr;
int main()
{
ll n;
cin>>n;
if((n*(n+1)/2)%2==0&&n!=2)
cout<<"0"<<endl;
else
cout<<"1"<<endl;
z=n*(n+1)/4;
for(ll i=n;i>0;i--)
{
if(z-i>=0)
{
arr.push_back(i);
z-=i;
}
else if(z==0)
break;
}
cout<<arr.size()<<" ";
for(ll i=0;i<arr.size();i++)
cout<<arr[i]<<" ";
}
1088B - Ehab and subtraction | 1270B - Interesting Subarray |
478C - Table Decorations | 1304C - Air Conditioner |
1311C - Perform the Combo | 1519C - Berland Regional |
361A - Levko and Table | 5E - Bindian Signalizing |
687A - NP-Hard Problem | 1542C - Strange Function |
961E - Tufurama | 129D - String |
888A - Local Extrema | 722B - Verse Pattern |
278A - Circle Line | 940A - Points on the line |
1742C - Stripes | 1742F - Smaller |
1742B - Increasing | 1742A - Sum |
1742D - Coprime | 390A - Inna and Alarm Clock |
1398B - Substring Removal Game | 1742G - Orray |
416B - Art Union | 962A - Equator |
803B - Distances to Zero | 291A - Spyke Talks |
1742E - Scuza | 1506D - Epic Transformation |